/* GUI CONVERTED from WOWARP.P (converter v1.76) Mon Sep 17 22:18:54 2001 */
/* WOWARP.P - ALLOCATIONS BY ITEM REPORT                                      */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.16 $                                                        */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 1.0      LAST MODIFIED: 05/12/86   BY: PML                       */
/* REVISION: 1.0      LAST MODIFIED: 05/01/86   BY: EMB                       */
/* REVISION: 1.0      LAST MODIFIED: 09/02/86   BY: EMB *12*                  */
/* REVISION: 2.1      LAST MODIFIED: 10/16/87   BY: WUG *A94*                 */
/* REVISION: 4.0      LAST MODIFIED: 02/24/88   BY: WUG *A175*                */
/* REVISION: 5.0      LAST MODIFIED: 04/10/89   BY: MLB *B096*                */
/* REVISION: 5.0      LAST MODIFIED: 10/26/89   BY: emb *B357*                */
/* REVISION: 6.0      LAST MODIFIED: 01/22/91   BY: bjb *D248*                */
/* REVISION: 7.3      LAST MODIFIED: 11/19/92   By: jcd *G348*                */
/* REVISION: 7.3      LAST MODIFIED: 02/09/93   By: emb *G656*                */
/* REVISION: 7.2      LAST MODIFIED: 02/28/95   BY: ais *F0KM*                */
/* REVISION: 7.4      LAST MODIFIED: 03/29/95   BY: dzn *F0PN*                */
/* REVISION: 8.6      LAST MODIFIED: 10/13/97   BY: ays *K0WP*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KC* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 08/15/00   BY: *N0LB* Arul Victoria      */
/* REVISION: 9.1      LAST MODIFIED: 10/27/00   BY: *N0TF* Katie Hilbert      */
/* Revision: 1.12     BY: Katie Hilbert         DATE: 04/01/01 ECO: *P008*    */
/* Revision: 1.15     BY: Vivek Gogte           DATE: 04/30/01 ECO: *P001*    */
/* $Revision: 1.16 $   BY: Manjusha Inglay       DATE: 08/28/01 ECO: *P01R*    */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

define variable vend like wo_vend no-undo.
define variable nbr like wod_nbr no-undo.
define variable nbr1 like wod_nbr no-undo.
define variable part like wod_part label "Component" no-undo.
define variable part1 like wod_part no-undo.
define variable site  like wod_site no-undo.
define variable site1 like wod_site no-undo.
define variable iss_date like wod_iss_date no-undo.
define variable iss_date1 like wod_iss_date no-undo.
define variable so_job like wo_so_job no-undo.
define variable so_job1 like wo_so_job no-undo.
define variable desc1 like pt_desc1 no-undo.
define variable open_ref like wod_qty_all label "Qty Open" no-undo.
define variable parent_part like ps_par no-undo.
define variable so_job_nbr like wo_so_job no-undo.
define variable all_pick like wod_qty_all label "Qty Alloc/Pick" no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
   part           colon 15
   part1          label {t001.i} colon 49 skip
   nbr            colon 15
   nbr1           label {t001.i} colon 49 skip
   site           colon 15
   site1          label {t001.i} colon 49 skip
   iss_date       colon 15
   iss_date1      label {t001.i} colon 49 skip
 SKIP(.4)  /*GUI*/
 with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}

/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if part1 = hi_char then part1 = "".
   if site1 = hi_char then site1 = "".

   if c-application-mode <> 'web' then
      
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update &fields = "  part part1 nbr nbr1 site site1
         iss_date iss_date1" &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data')) then do:

      bcdparm = "".
      {mfquoter.i part   }
      {mfquoter.i part1  }
      {mfquoter.i nbr    }
      {mfquoter.i nbr1   }
      {mfquoter.i site   }
      {mfquoter.i site1  }
      {mfquoter.i iss_date}
      {mfquoter.i iss_date1}

      if part1 = "" then part1 = hi_char.
      if site1 = "" then site1 = hi_char.

   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



   {mfphead.i}

   /* FIND AND DISPLAY */
   for each wod_det where (wod_part >= part and wod_part <= part1)
         and (wod_nbr >= nbr)   and (wod_nbr <= nbr1 or nbr1 = "")
         and (wod_site >= site) and (wod_site <= site1)
         and (wod_iss_date >= iss_date or iss_date = ?)
         and (wod_iss_date <= iss_date1 or iss_date1 = ?)
         no-lock break by wod_part by wod_nbr
      with frame b width 132 no-attr-space down:
      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).
      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


      if first-of(wod_part) then do:
         desc1 = "".
         find pt_mstr where pt_part = wod_part no-lock no-error.
         if available pt_mstr then desc1 = pt_desc1 + " " + pt_desc2.
         if page-size - line-counter < 5 then page.
         do with frame c:
            /* SET EXTERNAL LABELS */
            setFrameLabels(frame c:handle).
            display
               wod_part
               desc1 format "x(49)" no-label
               pt_um when (available pt_mstr)
            with frame c side-labels width 132 page-top STREAM-IO /*GUI*/ .
         end.
      end.

      open_ref = wod_qty_req - wod_qty_iss.

      if wod_qty_req >= 0
      then open_ref = max(wod_qty_req - wod_qty_iss,0).
      else open_ref = min(wod_qty_req - wod_qty_iss,0).

      assign
         all_pick = wod_qty_all + wod_qty_pick
         parent_part = ""
         so_job_nbr = "".

      find wo_mstr where wo_lot = wod_lot no-lock no-error.
      if available wo_mstr then do:
         assign
            parent_part = wo_part
            so_job_nbr = wo_so_job.
         if wo_status = "C" then open_ref = 0.
      end.

      accumulate wod_qty_req (total by wod_part).
      accumulate wod_qty_all (total by wod_part).
      accumulate wod_qty_pick (total by wod_part).
      accumulate all_pick (total by wod_part).
      accumulate open_ref (total by wod_part).

      display space(1)
         wod_nbr 
         wod_lot 
         parent_part
         wod_op
         wod_qty_req 
         /*all_pick label "Qty Alloc/Pick"*/
         wod_qty_all
         wod_qty_pick
         open_ref label "  Qty Open" 
         wod_iss_date
         so_job_nbr WITH STREAM-IO /*GUI*/ .

      if available wo_mstr then display wo_status WITH STREAM-IO /*GUI*/ .

      if last-of(wod_part) then do with frame b:
         if page-size - line-counter < 2 then page.
         display WITH STREAM-IO /*GUI*/ .

         down 1.

         underline wod_qty_req wod_qty_all wod_qty_pick open_ref.

         display
            getTermLabel("ITEM_TOTAL",17) + ":" @ parent_part
            (accum total by wod_part (wod_qty_req)) @ wod_qty_req
            (accum total by wod_part (wod_qty_all)) @ wod_qty_all
            (accum total by wod_part (wod_qty_pick)) @ wod_qty_pick
            (accum total by wod_part (open_ref)) @ open_ref WITH STREAM-IO /*GUI*/ .

         down 1.
      end.
   end.

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

end.

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" part part1 nbr nbr1 site site1 iss_date iss_date1 "} /*Drive the Report*/
